/**
 * Created by user on 2015/9/28.
 */

var dataSyncService = require('../../../services/mis/master/dataSyncService');
var messageUtil = require('../../../common/utils/messageUtil');
var toolUtil = require('../../../common/utils/toolUtil');

exports.secondHandSync = function(req, res) {

    dataSyncService.secondHandSyncService(req, function (err, results) {

        if (err) {
            if(err.type == 'warning'){
                logger.warn('Warning happen when secondHandSync...' + err.message);
                res.json(messageUtil.composeFailedMessage(req, err.message));
            }else {
                logger.error('Exception happen when secondHandSync...' + err.message);
                res.json(messageUtil.composeFailedMessage(req, 'Exception happen when secondHandSync...'));
            }
        } else {
            res.json(messageUtil.composeSucceededMessage(req, null, results));
        }

    });

};